package leetcode.code1921;

import java.util.Arrays;

import leetcode.IDebug;
import leetcode.helper.H;

public class Solution implements IDebug {

	public int eliminateMaximum(int[] dist, int[] speed) {
		int len = dist.length;
		int[] arr = new int[len];
		for (int i = 0; i < len; i++) {
			arr[i] = (dist[i] + speed[i] - 1) / speed[i] - 1;
		}
		Arrays.sort(arr);
		for (int i = 0; i < arr.length; i++) {
			if (arr[i] < i) {
				return i;
			}
		}
		return arr.length;
	}

	@Override
	public void debug4() {
		H.compare(1, this.eliminateMaximum(H.str2array3("[5,4,3,3,3]"), H.str2array3("[1,1,5,3,1]")));
		H.compare(3, this.eliminateMaximum(H.str2array3("[1,3,4]"), H.str2array3("[1,1,1]")));
		H.compare(1, this.eliminateMaximum(H.str2array3("[1,1,2,3]"), H.str2array3("[1,1,1,1]")));
		H.compare(1, this.eliminateMaximum(H.str2array3("[3,2,4]"), H.str2array3("[5,3,2]")));

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
